//
// Notification.ts
// Author:qiuchun(362460803@qq.com)
// Time:2023.04.30 22:59:09
// Desc:消息类

export default class Notification {

    //消息名称
    private name: string = "";
    //消息数据
    private body: object = null as any;
    //消息类型
    private type: string = "";

    constructor(name: string, body?: object, type?: string) {
        if (typeof body === "undefined") {
            body = null as any;
        }
        else {
            this.body = body;
        }

        if (typeof type === "undefined") {
            type = null as any;
        }
        else {
            this.type = type;

        }
        this.name = name;
    }
    getName(): string {
        return this.name;
    };
    setBody(body: object): void {
        this.body = body;
    };
    getBody() {
        return this.body;
    };
    setType(type: string): void {
        this.type = type;
    };
    getType() {
        return this.type;
    };
    toString(): string {
        var msg = "Notification Name: " + this.getName();
        msg += "\nBody:" + ((this.getBody() == null) ? "null" : this.getBody().toString());
        msg += "\nType:" + ((this.getType() == null) ? "null" : this.getType());
        return msg;
    };
}